Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/AN-4041 implement license and interval selection #64

Merged
merged 8 commits into from
May 6, 2024

Conversation

MGJamJam
Copy link
Contributor

@MGJamJam MGJamJam commented May 2, 2024

Issue: https://bitmovin.atlassian.net/browse/AN-4041, https://bitmovin.atlassian.net/browse/AN-4109, https://bitmovin.atlassian.net/browse/AN-4108

Work:

  • Implements the license selection and query selection in the QueryEditor
  • Adds ceiling of start timestamps to not show incomplete datapoints at the beginning of a graph

image

image

@MGJamJam MGJamJam requested review from Svarozic and sabe25 May 2, 2024 14:14
@@ -1,14 +1,13 @@
import { DataSourceJsonData } from '@grafana/data';
import { DataQuery } from '@grafana/schema';
import { QueryInterval } from './utils/intervalUtils';

export interface MyQuery extends DataQuery {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe instead of name MYQuery we could call in BitmovinAnalyticsDataQuery ?

Comment on lines +63 to +67
{
name: 'VIDEO_STARTUPTIME',
operator: 'GT',
value: 0,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a comment why is this one filter included always by default ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just temporary, I put it in for testing the editor. As soon as the filter selection implementation is ready this will be substituted by the filter selection value.

const licenseEndpoints = [
{
endpoint: '/analytics/licenses',
mapperFunc: (license: any): SelectableValue => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets use typescript, license is not any , it is at least some structure that contains these properties

Suggested change
mapperFunc: (license: any): SelectableValue => ({
mapperFunc: (license: {licenseKey: string; name: string, id: string;}): SelectableValue => ({

so you can extract that type to type AnyLicense and use that

.. same comment for other mapperFunc functions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it makes sense to install the bitmovin api sdk just for the typing? Or better to just create the AnalyticsType here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would create custom Analytics type, same type having "base license fields". Such base type is not present in our api SDK, so we also did same in Dashboard, to be able to have some type in AnalyticsLicensePicker

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

},
];

async function fetchLicensesForEndpoint(url: string, apiKey: string, mapperFunc: (license: any) => SelectableValue) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace any

@MGJamJam MGJamJam requested a review from Svarozic May 6, 2024 10:46
type AnalyticsLicense = {
readonly name: string;
readonly id: string;
readonly licenseKey?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why optional ? I think our licenses from backend always have licenseKey field set ?

Copy link
Contributor Author

@MGJamJam MGJamJam May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Virtual and demo license do not have a licenseKey field but only the id, that's why I marked it as optional.

@MGJamJam MGJamJam merged commit 182e924 into migrate-to-react May 6, 2024
3 checks passed
@MGJamJam MGJamJam deleted the feat/AN-4041_implement-license-selection branch May 6, 2024 13:39
MGJamJam added a commit that referenced this pull request Jul 4, 2024
* add new plugin template with create-plugin

* implement ConfigEditor

* use config props in the datasource

* fix wrong value for tenantOrgId

* make Input required

* add Bitmovin logo

* implements the testDatasource method

* add useEffect to automatically set the url

* adds comment for useEffect

* improves ErrorMessage

* implements the query method with DataFrame transformation

* extracts data transforming into own functions and improves code readability

* extracts data transformation of table data and simple time series data into own functions

* improves java doc and comments

* adds unit tests for dataUtils and adds error and edge case handling

* changes query parameter

* trigger tests on every branch push

* Revert "trigger tests on every branch push"

This reverts commit c03c5b2.

* implements PR feedback

* lint

* extract groupedTimeSeriesTimestamps with zip instead of map to align code

* simplify QueryInterval type and move it to intervalUtils file

* delete unused QueriIntervals

* Feat/AN-4043 setup ci on every push (#62)

* trigger ci pipeline on every push

* move github folder to root folder

* Run go to grafana folder action as first action

* add default working directory

* add directory to uses option

* try sparse-checkout option

* try path option

* try path option for node setup

* add default working-directory

* use sparse-checkout with cone-mode false

* use sparse-checkout with cone-mode false

* adds github ref

* list repository structure

* add default repository

* delete list structure

* add go to folder

* delete go to folder

* add cache dependency path

* update docker-compose.yaml

* Add TODOs

* fixes is_compatible workflow

* deletes partial repo checkout

* deletes partial repo checkout

* fix linting

* Feat/AN-4041 implement license and interval selection (#64)

* implements license fetching and interval selection

* add tests for intervalUtils

* fix ceiling of timestamp for DAY interval

* add tests

* fix linting

* delete unnecessary export of enum

* rename MyQuery to BitmovinAnalyticsDataQuery

* add AnalyticsLicenseType

* Feat/AN-4106 implement aggregation selection (#65)

* implements license fetching and interval selection

* add tests for intervalUtils

* fix ceiling of timestamp for DAY interval

* add tests

* fix linting

* delete unnecessary export of enum

* implement metric selection

* Feat/AN-4107 implement dimension selection (#66)

* implement dimension selection

* fix linting errors

* add metric support

* add metric to query and check for null instead of undefined

* fix merge commit

* Feat/AN-4110 implement group by selection (#68)

* implements license fetching and interval selection

* add tests for intervalUtils

* fix ceiling of timestamp for DAY interval

* add tests

* fix linting

* delete unnecessary export of enum

* implement metric selection

* implement dimension selection

* fix linting errors

* add metric support

* add metric to query and check for null instead of undefined

* implements groupBy selection

* fix linting

* implements reordering of GroupBys and fixes position of Add Button

* make props readonly

* Feat/AN-4112 implement order by selection (#69)

* implements license fetching and interval selection

* add tests for intervalUtils

* fix ceiling of timestamp for DAY interval

* add tests

* fix linting

* delete unnecessary export of enum

* implement metric selection

* implement dimension selection

* fix linting errors

* add metric support

* add metric to query and check for null instead of undefined

* implements groupBy selection

* fix linting

* implements reordering of GroupBys and fixes position of Add Button

* make props readonly

* implements order By selection

* splits orderBy state into two seperate states to fix rendering and renames variables

* lint

* Feat/AN-4111 implement filter selection (#70)

* add queryFilter type and renames AnalyticsDataQuery and AnalyticsRequestQuery type

* implements filter selection

* implements labels for filter selection fields

* corrects wrong label for add order by and filter selection

* corrects wrong label for delete tooltip

* add AddFilter button and Filter validation

* lint

* do not set value if value isEmpty for GroupBy and OrderBy Input

* fix deleteFilterInput to use the converted values instead of rawValues

* deletes reordering of FilterInputs

* refactors FilterRow to use one Filter object as local state

* add tests for filterUtils

* implement PR Feedback

* Feat/AN-4118 implement limit selection (#71)

* add limit selection

* add radix parameter for parseInt function

* lint

* Feat/AN-4121 implement aliasby selection (#72)

* implement alias By selection

* rename onChange Methods to handle...

* add Default values for query editor (#73)

* move and rename typings

* improve code readability

* Feat/AN-4135 pass query parameters to components (#74)

* make GroupByRow controlled

* make OrderByRow controlled

* make FilterByRow controlled

* make simple selection controlled

* fix groupBy types

* fix interval default value bug

* rename filterRow prop

* delete TODOs

* split useEffect and useMemo for isMetricSelected

* lint

* refactor FilterRow and QueryEditor to hold UI related Row data as local state

* implement PR feedback

* add unit tests for mapQueryFilterValueToRawFilterValue

* Feat/AN-4127 update readme (#75)

* make GroupByRow controlled

* make OrderByRow controlled

* make FilterByRow controlled

* make simple selection controlled

* fix groupBy types

* fix interval default value bug

* rename filterRow prop

* delete TODOs

* split useEffect and useMemo for isMetricSelected

* lint

* update Readme

* delete TODOS and add example_dashboard

* reorders sections

* set defaultValue and not value top be able to change the limit and alisBy field

* Add Warning QueryResultMetaNotice to data frame produced by datasource.ts, when rowCount is higher/equal 200

* feature/AN-3212/AN-4161_change-the-add-filter-icon-in-query-editor (#77)

* Rewrite FilterInput.tsx to QueryFilterInput.tsx

- remove label arg from util convertFilterForAds, convertFilter, because we dont need that dep there

* - remove obsolete `disable` prop

* add Tooltips for QueryFilterInputSelects

---------

Co-authored-by: MGJamJam <[email protected]>

* Replace enums with const array of string (aggregations, metrics, query (ad) attributes, query filter operators) (#79)

* Feat/AN-4128 make new data query compatible with old example dashboard json (#78)

* adapt license, metric, dimension, filter and alias to work with old query type

* add migration for filters and table/timeseries options

* lint

* lint

* add type predicates for OldBitmovinAnalyticsDataQuery

* implement percentile input

* renames percentile to percentileValue

* separates metric, query aggregations and query attributes

* change metric values to lower case

* makes filter, dimension, metric and limit compatible with old JSON

* rename QueryFilter types

* Feat/AN-4160 update example dashboard (#80)

* delete filtering of attributes for already used attributes and add error_code to null filter

* update example_dashboard

* delete files related to angular plugin

* move files to root folder and delete subfolder

* add dist folder

* change gitignore to exclude dist folder

* add dist folder to eslint ignore pattern

* Fix/AN-4193 fix missing tenant id request header (#81)

* add tenant orf id to request header

* implement PR feedback

* fmt

* make plugin compatible with grafana v10.2.0

* make plugin compatible with grafana v10.1.0

* rename adAnalytics to isAdAnalytics

* update License

* update License

* filter incomplete Queries

* update changelog

* delete datasource details in example_dashboard

* update plugin description and README

---------

Co-authored-by: Peter Petraník <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants